#pragma once
#ifndef ENTITYLIVING_H
#define ENTITYLIVING_H

#include "DXUT.h"
#include "Entity.h"
#include "StatusEffects.h"
#include "../Chunk.h"

class EntityLiving : public Entity {
protected:
	double		m_HP, m_MaxHP;		/* Healthpoints | -1 -> infinit */ 
	float		m_HPreg;			/* Dmg-regeneration */
	float		m_HPregmod;
	double		m_EP, m_MaxEP;		/* Energypoints | -1 -> infinit */
	float		m_EPreg;
	Armor		m_Armor;			/* Dmgmodefier  | 1 -> 100% dmg, 2 -> 50% dmg */
	float		m_Speed;			/* Speedmodefier */

	bool		m_Swimming;
	float		m_Dropheight;

	bool		m_Living;

	Status		m_Burning;			/* ID = 1 */
	Status		m_Poisoned;			/* ID = 2 */
	Status		m_Chilled;			/* ID = 3 */
	Status		m_Regeneration;		/* ID = -1 */

	virtual void calcHP(Block block, float temp, float humid, float fElapsedTime);
	virtual void calcEP(Block block, float temp, float humid, float fElapsedTime);
	virtual void calcStatus(float fElapsedTime);

public:
	EntityLiving(const D3DXVECTOR3& pos);
	EntityLiving(const D3DXVECTOR3& pos, const D3DXAABB& aabb);

	float	getHP();
	float	getMaxHP();
	float	getHPRatio();
	float	getHPregRatio();
	float	getEPRatio();
	float	getMaxEP();

	void OnFrameMove( EntityWorld* pWorld, double fTime, float fElapsedTime);

	virtual	bool isLiving() {return m_Living;};
			bool isBurning() {return m_Burning.aktiv();};
			bool isPoisoned() {return m_Poisoned.aktiv();};
	virtual void inflictDamage(Damage dmg);
	virtual void inflictStatus(int type, float time);
};


#endif